package com.pkcargo.entity.cargo;

import com.pkcargo.entity.IdEntity;
import com.pkcargo.entity.search.Metadata;

import javax.persistence.*;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * Created by IntelliJ IDEA.
 * User: Howard
 * Date: 2009-4-18
 * Time: 14:25:50
 * To change this template use File | Settings | File Templates.
 */
@Entity
//表名与类名不相同时重新定义表名.
@Table(name = "CARGOS")
//默认的缓存策略.
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Cargo extends IdEntity {
    private String startCity;
    private String endCity;
    private String cargoType;//直客，拼箱，整箱
    private String comment;//备注
    private String contact;//直接联系方式

    private Metadata metadata;//元数据，用于查询和列表

    @OneToOne(cascade={CascadeType.ALL})
    @JoinColumn(name="metadata_id",nullable=false)
    public Metadata getMetadata() {
        return metadata;
    }

    public void setMetadata(Metadata metadata) {
        this.metadata = metadata;
    }

    public String getStartCity() {
        return startCity;
    }

    public void setStartCity(String startCity) {
        this.startCity = startCity;
    }

    public String getEndCity() {
        return endCity;
    }

    public void setEndCity(String endCity) {
        this.endCity = endCity;
    }

    public String getCargoType() {
        return cargoType;
    }

    public void setCargoType(String cargoType) {
        this.cargoType = cargoType;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public String getContact() {
        return contact;
    }

    public void setContact(String contact) {
        this.contact = contact;
    }
}